package com.matrix.java.chap_05;

import java.util.Scanner;

/*
    财务应用程序：复利值
 */
public class Ex5_30 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("数目: ");
        int amount = input.nextInt();
        System.out.print("年利率: ");
        int yearRate = input.nextInt();
        System.out.print("月份数: ");
        int month = input.nextInt();
        input.close();

        double monthRate = (double) yearRate / (12 * 100);
        double sum = 0;
        for (int i = 1; i <= month; i++) {
            sum = (amount + sum) * (1 + monthRate);
        }
        System.out.printf("%.3f", sum);
    }
}
